package com.search.es.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Configuration;

//@Configuration
public class RestConfig {

    public RestHighLevelClient elasticsearchClient() {
        //单个地址
        RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(new HttpHost("192.168.182.160", 9200, "http")));
        //集群
//        RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(new HttpHost("192.168.1.66", 9200, "http"),
//                new HttpHost("192.168.1.66", 9201, "http"),
//                new HttpHost("192.168.1.66", 9202, "http")));
        return client;
    }
}
